package com.fuxi.cloud.api;

/**
 * JmReportTokenServiceI
 *
 * @Author: 扫地僧
 * @CreateTime: 2021-04-19
 */
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;

import com.fuxi.cloud.common.util.JimuSpringContextUtils;
import org.springframework.http.HttpHeaders;

public interface JmReportTokenServiceI {
    public static final String SYS_USER_CODE = "sysUserCode";

    public static final String SYS_ORG_CODE = "sysOrgCode";

    default String getToken(HttpServletRequest request) {
        String str = request.getParameter("token");
        if (str == null)
            str = request.getHeader("X-Access-Token");
        return str;
    }

    default String getToken() {
        HttpServletRequest httpServletRequest = JimuSpringContextUtils.getHttpServletRequest();
        return getToken(httpServletRequest);
    }

    String getUsername(String paramString);

    Boolean verifyToken(String paramString);

    default Map<String, Object> getUserInfo(String token) {
        HashMap<Object, Object> hashMap = new HashMap<>();
        hashMap.put("sysUserCode", getUsername(token));
        hashMap.put("sysOrgCode", "");
        return (Map)hashMap;
    }

    default HttpHeaders customApiHeader() {
        return null;
    }
}